package com.gpsnav.file;

final class FileExplorerJournalListener {
    /*
import net.rim.device.api.io.file.FileSystemJournal;
import net.rim.device.api.io.file.FileSystemJournalEntry;
import net.rim.device.api.io.file.FileSystemJournalListener;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.Dialog;

final class FileExplorerJournalListener implements FileSystemJournalListener{
    private FileExplorerScreen _screen;
    private long _lastUSN; // = 0;
    
    FileExplorerJournalListener(FileExplorerScreen screen) {
        _screen = screen;
    }

    
    public void fileJournalChanged() {
        long nextUSN = FileSystemJournal.getNextUSN();
        String msg = null;
        
        for (long lookUSN = nextUSN - 1; lookUSN >= _lastUSN && msg == null; --lookUSN) {
            FileSystemJournalEntry entry = FileSystemJournal.getEntry(lookUSN);
            
            // We didn't find an entry.
            if (entry == null) break;

            // Check if this entry was added or deleted.
            String path = entry.getPath();
            
            if (path != null){
                switch (entry.getEvent()){
                    case FileSystemJournalEntry.FILE_ADDED:
                        msg = "File was added.";
                        break;
                        
                    case FileSystemJournalEntry.FILE_DELETED:
                        msg = "File was deleted.";
                        break;
                }
            }
        }
        _lastUSN = nextUSN;
        
        if ( msg != null ) {
            showMessage(msg);
            //_screen.updateList();
        }
    }
    
    private void showMessage(String msg) {
        synchronized (UiApplication.getApplication().getAppEventLock()){
            Dialog.alert(msg);
        }
    }
*/
}
